//
//  main.cpp
//  opencv_project
//
//  Created by 黄琛 on 2018/12/17.
//  Copyright © 2018 黄琛. All rights reserved.
//

#include "opencv2/opencv.hpp"

using namespace cv;

int main(void)
{
    Mat image = imread("Lena.jpg");
    Mat image_rs, hsv, rgbchannels[3], hsvchannels[3];
    
    //将图像缩小一半
    pyrDown(image, image_rs);
    imshow("resized image", image_rs);
    
    //显示RGB分量
    split(image_rs, rgbchannels);
    imshow("Blue", rgbchannels[0]);
    imshow("Green", rgbchannels[1]);
    imshow("Red", rgbchannels[2]);
    
    //显示HSV分量
    cvtColor(image_rs, hsv, COLOR_BGR2HSV);
    split(hsv, hsvchannels);
    imshow("Hue", hsvchannels[0]);
    imshow("Saturation", hsvchannels[1]);
    imshow("Value", hsvchannels[2]);
    
    waitKey();
    
    
}
